<template>
  <div class="multi-select">
    <div class="multi-title">
      <span>已选中：{{ value }} 条消息</span>
    </div>
    <div class="multi-main">
      <div class="btn-group">
        <div class="multi-icon pointer" @click="handleClick('merge_forward')">
          <i class="fa fa-share-square-o" style="margin-top:2px;margin-left:5px;"></i>
        </div>
        <p>合并转发</p>
      </div>
      <div class="btn-group">
        <div class="multi-icon pointer" @click="handleClick('forward')">
          <el-icon><ele-Promotion /></el-icon>
        </div>
        <p>逐条转发</p>
      </div>
      <div class="btn-group">
        <div class="multi-icon pointer" @click="handleClick('delete')">
          <el-icon><ele-Delete /></el-icon>
        </div>
        <p>批量删除</p>
      </div>
      <div class="btn-group">
        <div class="multi-icon pointer" @click="handleClick('close')">
          <el-icon><ele-Close /></el-icon>
        </div>
        <p>关闭</p>
      </div>
    </div>
  </div>
</template>

<script>
import { reactive, toRefs, watch } from 'vue'
export default {
    name: 'PanelToolbar',
    props: {
        modelValue: {
            type: Number,
            default: 0
        }
    },
    emits: ['update:modelValue'],
    setup(props, context) {
      const { modelValue } = toRefs(props)
      const state = reactive({
        value: 0
      })
      const handleClick = (event) => {
        context.emit('event', event)
      }
      watch(() => modelValue.value, 
        val => {
          state.value = val
        }
      )
      return {
        ...toRefs(state),
        handleClick
      }
    }
}
</script>

<style lang="scss" scoped>
.multi-select {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  .multi-title {
    width: 100%;
    height: 50px;
    line-height: 50px;
    text-align: center;
    color: #878484;
    font-weight: 300;
    font-size: 14px;
  }
  .multi-main {
    .btn-group {
      display: inline-block;
      width: 70px;
      height: 70px;
      margin-right: 15px;
      .multi-icon {
        width: 45px;
        height: 45px;
        display: flex;
        align-items: center;
        justify-content: center;
        background-color: #f5f5f5;
        border-radius: 50%;
        margin: 0 auto;
        border: 1px solid transparent;
        i{
          font-size: 18px;
        }
        &:hover {
          color: white;
          background: var(--el-color-primary);
          i{
            font-size: 20px;
          }
        }
      }
      p {
        font-size: 12px;
        margin-top: 8px;
        text-align: center;
      }
    }
  }
}
</style>